<!DOCTYPE html>
<style>
span.error {
	color: red;
}
</style>
<section class="content-header" style="padding: 3px 15px 0 15px;">
	<ol class="breadcrumb" id="nav_title"
		style="position:static;float:none;margin-bottom: 5px;">
		<li class="active"><i class="fa fa-home"
			style="font-size:20px;position:relative;top:2px;left:-3px;"></i>
			&nbsp; <a href="${rc.contextPath}/sys/index">首页</a>
		</li>
		<li class="active">系统管理</li><li class="active">菜单管理</li>
	</ol>
</section>

<div class="container-fluid">
	<div class="box box-primary">
		<div id="toolbar">
			<button id="authAdd" type="button" class="btn" data-toggle="modal" data-target="#modal-edit"
				style="margin-left:0px;padding:3px 18px;background:#3399fe;color:#fff;">新增</button>
			<button id="edit" type="button" class="btn" style="margin-left:10px;padding:3px 18px;background:#3399fe;color:#fff;">编辑</button>
			<button id="deleteBtn" type="button" class="btn"
				style="margin-left:10px;padding:3px 18px;background:#f93a3a;color:#fff;">删除</button>
		</div>
		<div class="row">
			<table id="table" data-toggle="table" data-url="authlist"
				data-toolbar="#toolbar" data-pagination="true" data-striped="true"
				data-search="true" data-page-size="10">
				<thead>
					<tr>
						<th data-checkbox="true"></th>
						<th data-align="center" data-field="auth_name" data-sortable="true">菜单名称</th>
						<th data-align="center" data-field="auth_url" data-sortable="true">菜单URL</th>
						<th data-align="center" data-field="parname" data-sortable="true">上级菜单</th>
						<th data-align="center" data-field="auth_type" data-formatter="type" data-sortable="true">菜单类型</th>
						<th data-align="center" data-field="auth_perms" data-sortable="true">授权标识</th>
						<th data-align="center" data-field="order_num" data-sortable="true">排序号</th>
						<th data-align="center" data-field="create_date" data-sortable="true">创建时间</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
</div>
<!-- 新增的弹窗 -->
<div class="modal fade" id="modal-edit" aria-labelledby="modalEditLabel" aria-hidden="true" tabindex="-1">
	<div class="modal-dialog">
		<div class="modal-content">
			<form class="form-horizontal" action="" method="post" id="addAuthForm">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title" id="modalEditLabel">菜单</h4>
				</div>
				<input name="authId" id="authId" type="hidden" class="form-control">
				<div class="modal-body">
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单类型</label>
						<div class="col-sm-9" id="wap">
							<input name="authType" id="ml" type="radio" value="0" checked="checked">目录&nbsp;&nbsp;
							<input name="authType" id="cd" type="radio" value="1" >菜单&nbsp;&nbsp;
							<input name="authType" id="an" type="radio" value="2" >按钮 &nbsp;&emsp;&emsp;&emsp;&emsp;&emsp;
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单名称</label>
						<div class="col-sm-9">
							<input name="authName" type="text" class="form-control"
								placeholder="菜单名称">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">上级菜单</label>
						<div class="col-sm-9">
							<select class="form-control" name="authParentId" id="parentId">
								<option value="0" selected="selected">---请选择---</option> 
								#foreach($list in $list)
								<option value="${list.authId}">${list.authName}</option>
								#end
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">菜单URL</label>
						<div class="col-sm-9">
							<input name="authUrl" id="authUrl" type="text" class="form-control"
								placeholder="菜单URL">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">授权标识</label>
						<div class="col-sm-9">
							<input name="authPerms" id="authPerms" type="text" class="form-control" placeholder="授权标识">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">排序号</label>
						<div class="col-sm-9">
							<input name="orderNum" id="orderNum" type="text" class="form-control" placeholder="排序号">
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default closeBtn" data-dismiss="modal">关闭</button>
					<button id="saveBtn" type="submit" class="btn btn-primary">保存</button>
				</div>
			</form>
		</div>
	</div>
</div>

<customScript> 
<script type="text/javascript">
	function type(value, row, index) {
		var type = row.auth_type;
		if(type == 0){
			return [
				"<span class='label label-primary'>目录</span>"
			].join('');	
		}
		if(type == 1){
			return [
				"<span class='label label-success'>菜单</span>"
			].join('');	
		}
		if(type == 2){
			return [
				"<span class='label label-warning'>按钮</span>"
			].join('');	
		}
	}
</script> 
<script type="text/javascript" src="${rc.contextPath}/views/admin/system/sysauth.js"></script> 
<script type="text/javascript" src="${rc.contextPath}/assets/js/ajax.js"></script> 
</customScript>